package com.hitqz.robot.biz.util;

import cn.hutool.extra.spring.SpringUtil;
import com.hitqz.robot.api.business.component.ExcelDynamicSelect;
import com.hitqz.robot.api.common.entity.PatrolObject;
import com.hitqz.robot.biz.service.impl.PatrolObjectServiceIml;

import java.util.List;

public class PatrolObjectSelector implements ExcelDynamicSelect {

    @Override
    public String[] getSource() {
        PatrolObjectServiceIml patrolObjectServiceIml = SpringUtil.getBean(PatrolObjectServiceIml.class);
        List<PatrolObject> list = patrolObjectServiceIml.list();
        List<String> strList = list.stream().map(f -> f.getId() + "_" + f.getName()).toList();
        return strList.toArray(new String[0]);
    }

}
